package cz.cacek.ebook;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * Intro page with Ebook splash-screen
 * @author Tom� Darmovzal [tomas.darmovzal (at) seznam.cz]
 * @author Josef Cacek [josef.cacek (at) atlas.cz]
 * @author $Author: kwart $
 * @version $Revision: 1.4 $
 * @created $Date: 2006/12/26 09:08:49 $
 */
public class EBookIntro extends Canvas {
	protected EBookMIDlet midlet;

	public static final long MIN_MILIS_DISPLAY = 1000;

	/**
	 * Constructor
	 * @param aMidlet
	 * @throws Exception
	 */
	public EBookIntro(EBookMIDlet aMidlet) throws Exception {
		midlet = aMidlet;
	}

	/* (non-Javadoc)
	 * @see javax.microedition.lcdui.Displayable#paint(javax.microedition.lcdui.Graphics)
	 */
	public void paint(Graphics g) {
		try {
			int w = getWidth();
			int h = getHeight();
			Image img = Image.createImage("/ebook.png");
			g.setColor(0xFFFFFF);
			g.fillRect(0, 0, w, h);
			g.drawImage(img, (w - img.getWidth()) / 2,
					(h - img.getHeight()) / 2, Graphics.LEFT | Graphics.TOP);
		} catch (Exception e) {
			//e.printStackTrace();
			Utils.error("EBookIntro.paint(...) failed:"+e.getMessage(), e);
		}
	}
}
